package com.ashley.apptools.provider;


import com.ashley.apptools.provider.ToolsData.Category;
import com.ashley.apptools.provider.ToolsData.ItemNumber;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

	public static final String DATABASE_NAME = "data.db";
	public static final int DATABASE_VERSION = 1;
	public DatabaseHelper(Context context) {
		
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		// TODO Auto-generated method stub
		
		arg0.execSQL("CREATE TABLE " + Category.TABLE_NAME + " ("
                + Category._ID + " INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
                + Category.COLUMN_NAME_TITLE + " VARCHAR(20)  NOT NULL,"
                + Category.COLUME_LANDING + " NUMERIC  NULL,"
                + Category.COLUME_WAREHOVSE + " NUMERIC  NULL,"
                + Category.COLUME_SALE + " NUMERIC  NULL"
                + ");");
		arg0.execSQL("CREATE TABLE " + ItemNumber.TABLE_NAME + " ("
                + ItemNumber._ID + " INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
                + ItemNumber.COLUME_CATEGORY + " INTEGER  NOT NULL,"
                + ItemNumber.COLUME_ITEM_NO + " VARCHAR(30)  NOT NULL,"
                + ItemNumber.COLUME_PRICE + " NUMERIC  NULL,"
                + ItemNumber.COLUME_CUBE + " NUMERIC  NULL,"
                + ItemNumber.COLUME_FREIGHT + " NUMERIC  NULL,"
                + ItemNumber.COLUME_TAX + " NUMERIC  NULL,"
                + ItemNumber.COLUME_LANDING + " NUMERIC  NULL,"
                + ItemNumber.COLUME_WAREHOVSE + " NUMERIC  NULL,"
                + ItemNumber.COLUME_SALE + " NUMERIC  NULL,"
                + ItemNumber.CLUME_RETAIL + " NUMERIC  NULL,"
                + "creationtime  NUMERIC  NULL"
                + ");");
		
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('',null,null,null)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Stationary Upholstery',12.2,3,4)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Top of Bed',22.2,13,24)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Walls',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Youth Bedroom',1.2,2,5)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Stationary Leather',1.2,2,5)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Sectionals',1.2,2,5)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Walls',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Rugs',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Recliners',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Occasional',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Motion Upholstery',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Motion Leather',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Mirrors',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Metal Beds',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Mattresses',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Master Bedroom',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Lamps',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Home Office',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Formal Dining',32.2,43,64)");		
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Entertainment',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Dining',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Curios',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Chairs',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Casual Dining',32.2,43,64)");
		arg0.execSQL("INSERT INTO category (title,landing,warehovse,sale) VALUES ('Accents',32.2,43,64)");
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		
	}

}
